package com.atguigu.cloud.controller;


import com.atguigu.cloud.entities.Order;
import com.atguigu.cloud.service.OrderService;
import com.atguigu.cloud.utils.ResultData;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: huahua
 * @Date: 2024/6/26 0026
 * @Time: 17:11
 * @Description:
 */

@RestController
public class OrderController {
    @Resource
    private OrderService orderService;

    /**
     * 测试方法
     */
    @GetMapping("/test")
    public ResultData test() {

        return ResultData.success(orderService.getById(1));
    }


    /**
     * 创建订单
     */
    @GetMapping("/order/create")
    public ResultData create(Order order)
    {
        orderService.create(order);
        return ResultData.success(order);
    }
}
